﻿/*************************************************************
 * Software of blackcore
 *
 * CLRVersion:4.0.30319.586
 * MachineName:SPACE
 * Author:Andy Huang
 * Email:itblackhole@gmail.com
 * DateTime：6/25/2013 5:18:07 PM
 * Function：
 *************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using SobFS.Common.Database;

namespace SobFS.MySQLDAL
{
    public partial class SysFunctionMenu
    {
        #region ******************************Private Property******************************
        #endregion ******************************Private Property******************************


        #region ******************************Public Property******************************
        #endregion ******************************Public Property******************************


        #region ******************************Structure******************************
        #endregion  ******************************Structure******************************


        #region ******************************Private Method******************************
        #endregion ******************************Private Method******************************


        #region ******************************Public Method******************************
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere, string orderBy)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select Id,ParentId,Code,Name,URL,Position,Description,IsObsoleted,IsEnabled ");
            strSql.Append(" FROM SysFunctionMenu ");
            if (!string.IsNullOrWhiteSpace(strWhere))
            {
                strSql.Append(" where " + strWhere);
            }
            if (!string.IsNullOrWhiteSpace(orderBy))
            {
                strSql.Append(" ORDER BY " + orderBy);
            }
            return DbHelperMySQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得查询分页数据
        /// </summary>
        public DataSet GetList(int pageSize, int pageIndex, string strWhere, string filedOrder, out int recordCount)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT * FROM SysFunctionMenu");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" WHERE " + strWhere);
            }
            recordCount = Convert.ToInt32(DbHelperMySQL.GetSingle(PagingHelper.CreateCountingSql(strSql.ToString())));
            return DbHelperMySQL.Query(PagingHelper.CreatePagingSql(recordCount, pageSize, pageIndex, strSql.ToString(), filedOrder));
        }
        #endregion ******************************Public Method******************************
    }
}
